package abmb.utils;
import java.sql.Timestamp;
import java.util.ArrayList;
/**
 *This class is a definition for a microblog thread structure.
 * @author Andrea Balboni
 * @version 1.0
 */

public class MBPost {
    private Timestamp _postDate;
    private ArrayList<String> _tagList=new ArrayList<String>();
    private String _author;
    private String _username;
    private String _title;
    private String _body;
    private int _pID;
    private int _uID;
    public MBPost(){
        _postDate=new java.sql.Timestamp(System.currentTimeMillis());
    }
    public java.util.Date postDate(){return _postDate;}
    public ArrayList<String> tags(){return _tagList;}
    public String author(){return _author;}
    public String username(){return _username;}
    public String title(){return _title;}
    public String body(){return _body;}
    public void setPostDate(java.util.Date date){ _postDate=new java.sql.Timestamp(date.getTime());}
    public void tags(ArrayList<String> AL){_tagList=AL;}
    public void author(String authr){_author=authr;}
    public void username(String usrname){_username=usrname;}
    public void title(String ttle){_title=ttle;}
    public void body(String bdy) throws Exception{
        if(checkBodyLenght(bdy))
            _body=bdy;
        else throw new Exception("Invalid body lenght");
     }
    public void postID(int pID){
    	_pID=pID;
    }
    public boolean checkBodyLenght(String bdy){
        if(bdy.length()<=140)
            return true;
        else
            return false;
    }
	public int postID() {
		return this._pID;
	}
	public void userID(int uID){
		_uID=uID;
	}
	public int userID(){
		return _uID;
	}
}
